﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace Acando.Dynamics.CRM.Silverlight.Library.Types
{
    public class TreeNode
    {
        public String Name { get; set; }
        public TreeNode Parent { get; set; }
        public IList<TreeNode> Children { get; set; }
        public Boolean isTopLead { get; set; }
        public int Depth { get { return Parent == null ? 0 : Parent.Depth + 1; } }

        public TreeNode()
        {
            this.Name = string.Empty;
            this.Parent = null;
            this.Children = new List<TreeNode>();
        }

        public TreeNode CreateChild(string name)
        {
            TreeNode child = new TreeNode() { Name = name, Parent = this };
            Children.Add(child);

            return child;
        }
    }
}
